﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Web;
using System.Web.Http.Routing;

namespace apiframworkTest.Common
{
    public class MyRout : IHttpRoute
    {
        public string RouteTemplate { get; set; }

        public IDictionary<string, object> Defaults { get; set; }

        public IDictionary<string, object> Constraints { get; set; }

        public IDictionary<string, object> DataTokens { get; set; }

        public HttpMessageHandler Handler { get; set; }



        public IHttpRouteData GetRouteData(string virtualPathRoot, HttpRequestMessage request)
        {
            var ss=  request.GetRouteData();

            var ss1 = request.GetQueryNameValuePairs();
            Console.WriteLine(virtualPathRoot);
            if (request.RequestUri.AbsolutePath.Contains("frs"))
            {
                IHttpRouteData myuHttpRouteData = new MyuHttpRouteData()
                {
                    Values = new Dictionary<string, object>() {
                    { "controller", "Test" },
                    { "action","Get"} }
                };
                return myuHttpRouteData;
            }
            else
            {
                return null;
            }


        }

        public IHttpVirtualPathData GetVirtualPath(HttpRequestMessage request, IDictionary<string, object> values)
        {
            throw new NotImplementedException();
        }
    }
}